/********************************
Hoisting
*/

calculateAge(2000);

// 因为函数声明在creating phase被存储在variable object（在execution phase之前）
function calculateAge(year) {
    console.log(2018 - year);
}

console.log(window);

// 因为变量声明在creating phase被存储在variable object中，并被设为undefined
console.log(age);       // undefined
var age = 23;

// console.log(name);   会报错：Uncaught ReferenceError: name is not defined



/*
each new function creates a scope
*/
